package cn.gson.work.model.service;

import cn.gson.work.model.mapper.BudgetsMapper;
import cn.gson.work.model.pojos.Budcate;
import cn.gson.work.model.pojos.Budget;
import cn.gson.work.model.pojos.Project;
import cn.gson.work.model.pojos.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BudgetsService {
    @Autowired
    BudgetsMapper budgetMapper;
    public List<Budget> ys(String B_NAME){
        return budgetMapper.ys(B_NAME);
    }
    public List<Budcate> lei(){
        return budgetMapper.lei();
    }
    public List<User> gg(){
       return budgetMapper.gg();
    }
    public List<Project> xm(){
        return budgetMapper.xm();
    }

    //ID为空时进行新增，否则进行修改
    public void addBudget(Budget budget){
        if(budget.getbId()!=0){
            budgetMapper.sk(budget);
        }else {
            budgetMapper.addBudget(budget);
        }

    }

}
